{include file="public/header" /}
<body>
<style>
    .cion{
        display: inline-block;
        width: 120px;
    }
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> OTC管理
    <span class="c-gray en">&gt;</span> 卖家申诉列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="/otc/otc_appeal_order_lists" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form  method="get" action="">
        <div class="text-c">
            <span class="select-box" style="width: 100px;">
                <select name="select_type" class="select">
                    <option value="-1">查询条件</option>
                    <option value="1" {if isset($_GET['select_type']) && $_GET['select_type'] == 1}selected{/if}>买家订单号</option>
                    <option value="2" {if isset($_GET['select_type']) && $_GET['select_type'] == 2}selected{/if}>卖家订单号</option>
                    <option value="3" {if isset($_GET['select_type']) && $_GET['select_type'] == 3}selected{/if}>买家ID</option>
                    <option value="4" {if isset($_GET['select_type']) && $_GET['select_type'] == 4}selected{/if}>卖家ID</option>
                </select>
            </span>
            <input type="text" value="{:input('get.keyword')}" name="keyword" class="input-text" style="width:160px;">

            订单时间：
            <span class="select-box" style="width: 100px;">
                <select name="time_type" class="select">
                    <option value="-1">时间类型</option>
                    <option value="1" {if isset($_GET['time_type']) && $_GET['time_type'] == 1}selected{/if}>创建时间</option>
                    <option value="2" {if isset($_GET['time_type']) && $_GET['time_type'] == 2}selected{/if}>完成时间</option>
                    <option value="3" {if isset($_GET['time_type']) && $_GET['time_type'] == 3}selected{/if}>支付时间</option>
                </select>
            </span>
            <input type="text" onfocus="WdatePicker()" value="{:input('get.start')}" name="start" id="datemin" class="input-text Wdate" style="width:120px;" autocomplete="off">
            -
            <input type="text" onfocus="WdatePicker()" value="{:input('get.end')}" name="end" id="datemax" class="input-text Wdate" style="width:120px;" autocomplete="off">

            <span class="select-box" style="width: 100px;">
                <select name="status" class="select">
                    <option value="-1">全部状态</option>
                    <option value="3" {if isset($_GET['status']) && $_GET['status'] == 3}selected{/if}>申诉中</option>
                    <option value="4" {if isset($_GET['status']) && $_GET['status'] == 4}selected{/if}>申诉完成</option>
                </select>
            </span>
            <button type="submit" class="btn btn-success">搜索</button>
        </div>
    </form>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
        </span>
        <span class="r">共有数据：<strong>{$page->total()}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="12">申诉列表</th>
        </tr>
        <tr class="text-c">
            <th width="20">id</th>
            <th width="105" style="color: #00B83F">买家订单号</th>
            <th width="125" style="color: #00B83F">买家信息</th>
            <th width="100" style="color: #bd362f">卖家订单信息</th>
            <th width="125" style="color: #bd362f">卖家信息</th>
            <th width="60">购买数量</th>
            <th width="140">付款方式(查看凭证)</th>
            <th width="160">时间</th>
            <th width="50">申诉详情</th>
            <th width="50">备注</th>
            <th width="50">状态</th>
            <th width="80">操作(申诉结果)</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $v}
        <td>{$v.id}</td>
        <td>{$v.order_no}</td>
        <td>     买家姓名：{$v.buynickname}
            </br>买家手机：{$v.buymobile}
            </br>买家ID： {$v.buyer_uid}
        </td>
        <td>父订单ID：{$v.parent_order_id}</br>
            父订单号：</br>{$v.parent_order_no}</br>
        </td>
        <td>     卖家姓名：{$v.nickname}
            </br>卖家手机：{$v.mobile}
            </br>卖家ID： {$v.seller_uid}
        </td>
        <td style="text-align: center">{$v.buy_num} MT</td>
        <td>
            {if condition="$v['bank']['type'] eq 1"}<span style="color: #438eff">支付宝</span>:{$v['bank']['account']}&nbsp&nbsp{notempty name="v.credentials"}<em class="label label-success radius" style="cursor:pointer" onclick="lookc({$v.id})">查看凭证</em>{/notempty}{/if}
            {if condition="$v['bank']['type'] eq 2"}<span style="color: #22d059">微信</span>:{$v['bank']['account']}&nbsp&nbsp{notempty name="v.credentials"}<em class="label label-success radius" style="cursor:pointer" onclick="lookc({$v.id})">查看凭证</em>{/notempty}{/if}
            {if condition="$v['bank']['type'] eq 3"}<span style="color: #cd141a">银行卡</span>:{$v['bank']['bank_name']}&nbsp&nbsp{notempty name="v.credentials"}<em class="label label-success radius" style="cursor:pointer" onclick="lookc({$v.id})">查看凭证</em>{/notempty}{/if}
        </td>
        <td>
            <em style="color: #00b7ee">创建时间</em>: {$v.create_time}
            </br><em style="color: #bd362f">支付时间</em>: {$v.pay_time}
            </br><em style="color: #00B83F">完成时间</em>: {$v.finish_time}
        </td>
        <td style="text-align: center"><a href="javascript:" onclick="look_this({$v.appeal_id})">查看详情</a></td>
        <td>{$v.remark}</td>
        <td style="text-align: center">
            {switch name="$v.status"}
            {case value="3"}
            <span class="label label-default radius">申诉中</span>
            {/case}
            {case value="4"}
            <span class="label label-primary radius">申诉完成</span>
            {/case}
            {/switch}
        </td>
        <td style="text-align: center">
            {if condition="$v.status eq 3"}
                <a class="btn btn-primary radius" title="买家胜诉" href="javascript:;" onclick="otc_cause(1,{$v.id})">卖家胜诉</a>
            </br><em>|</em>
            </br><a class="btn btn-danger radius" title="卖家胜诉" href="javascript:;" onclick="otc_cause(2,{$v.id})">卖家败诉</a>
            {/if}
            {if condition="$v.status eq 4"}
                {if condition="$v.appeal_result eq 1"}<em class="btn btn-primary radius">卖家胜诉</em>{/if}
                {if condition="$v.appeal_result eq 2"}<em class="btn btn-danger radius">卖家败诉</em>{/if}
            {/if}
        </td>
        </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <div class="page">
        {$page->render()|raw}
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
    //调出判定理由页面
    function otc_cause(type,id) {
        switch (type) {
            case 1:
                var tip = '确认卖家胜诉吗？(订单取消，订单归置出售列表，买家账户变未激活)';
                break;
            case 2:
                var tip = '确认卖家败诉吗？(订单放行，买家收到MT，卖家账户变未激活)';
                break;
        }
        layer.confirm(tip,{
            btn: ["确定","取消"]
        },function (index) {
            layer.open({
                type: 2,
                title: '判定理由',
                area: ['450px', '255px'],
                fixed: false, //不固定
                maxmin: true,
                content: "otc_cause.html?ids=" + id,
                end:function(){
                    location.reload();
                },
                success: function (layero, index) {
                    //从父页面给自页面赋值
                    var jquerySendHelloButton = $('#typeid', layero.find("iframe")[0].contentWindow.document);
                    jquerySendHelloButton.attr("value", type);

                    var jquerySendHelloButton = $('#id', layero.find("iframe")[0].contentWindow.document);
                    jquerySendHelloButton.attr("value", id);


                },
            });
            layer.close(index);
        });
        // layer.close(index);
    }

    //调出凭证页面
    function lookc(id){
        layer.open({
            type: 2,
            title: '凭证',
            area: ['450px', '700px'],
            fixed: false, //不固定
            maxmin: true,
            content: "credentials.html?id="+id,
        });
    }
    //查看申诉详情
    function look_this(appeal_id) {
        layer.open({
            type: 2,
            title: '申诉详情',
            area: ['500px', '550px'],
            fixed: false, //不固定
            maxmin: true,
            content: "appeal_detail.html?id="+appeal_id,
        });
    }
</script>
